package cn.wolfcode.car.business.query;

import cn.wolfcode.car.common.base.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;

@Setter
@Getter
public class CarPackageAuditQuery  extends QueryObject {
    private Long auditorId; // 审核人id
    private Integer status; // 审核状态
    private String info;
    private String auditRecord; //

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginTime;         // 开始时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;           // 结束时间

    // 指定时间中的最后一秒
    public Date getEndTime() {
        if (endTime == null) {
            return null;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(endTime);
        cal.set(Calendar.HOUR_OF_DAY, 23);
        cal.set(Calendar.MINUTE, 59);
        cal.set(Calendar.SECOND, 59);
        return cal.getTime();
    }
}
